<template>
	<view>
		<view class="pc-box" v-for="(item,index) in commentList">
			<view class="pc-item">
				<view class="pc-i-t">
					<image :src="item.imageUrl" mode="aspectFill" class="pimg"></image>
					<view class="pc-name">
						<view>{{item.nickName}}</view>
						<!-- <u-rate :count="count" v-model="value" :disabled="true" size="28"></u-rate> -->
					</view>
				</view>
				<view class="pcon">
					{{item.content}}
				</view>
				<view class="piimg-box" v-if="item.commentImageUrl!=''">
					<image :src="it" mode="aspectFill" v-for="it in item.commentImageUrl.split(',')" class="p-img" @click="previewImage(url,item.commentImageUrl.split(','))"></image>
				</view>
				<view class="time">{{$u.timeFormat(item.createTime, 'yyyy-mm-dd hh:MM:ss')}}</view>
			</view>
		</view>
		
	</view>
</template>

<script>
	import {selectComment} from "../../api/index.js"
	import{pjcomment} from"../../api/product.js"
	export default{
		data(){
			return{
				id:'',
				commentList:[],
				type:1
			}
		},
		onLoad(e) {
			console.log(e)
			this.id=e.id
			if(e.type){
				this.type=e.type
			}
			this.getcommentlist()
			
		},
		methods:{
			// 查看大图
			previewImage(url,arr) {
				uni.previewImage({
					current:url,
					urls: arr
				});
			},
			getcommentlist(){
				let url=selectComment
				console.log(this.type)
				if(this.type==0){
					url=pjcomment
				}
				this.get(url,{id:this.id,pageNum:1,pageSize:10}).then(res=>{
					console.log(res)
					this.commentList=res.data.list
				})
			}
		}
	}
</script>

<style>
	.piimg-box{
		display: flex;
		flex-wrap: wrap;
		margin-top: 20rpx;
	}
	.piimg-box>image{
		width: 120rpx;
		height: 120rpx;
		margin: 0 10rpx;
	}
	.pc-item {
		width: 690rpx;
		margin: 0 auto 30rpx;
	}
	.pc-i-t {
		display: flex;
		align-items: center;
		height: 80rpx;
	}
	.pimg {
		width: 60rpx;
		height: 60rpx;
		background: rgba(0, 0, 0, 0);
		border-radius: 50%;
		opacity: 1;
		margin-right: 20rpx;
	
	}
	.pc-name {
		font-size: 24rpx;
		color: #666666;
	}
	.pcon {
		max-height: 66rpx;
		font-size: 24rpx;
		font-family: PingFang SC;
		font-weight: 400;
		line-height: 33rpx;
		color: #333333;
		opacity: 1;
		display: -webkit-box;
		/*将对象作为弹性伸缩盒子模型显示*/
		overflow: hidden;
		/* 超出的文本隐藏 */
		text-overflow: ellipsis;
		/* 溢出用省略号显示 */
		word-wrap: break-word;
		/* 文本高出宽度换行 */
		white-space: normal !important;
		/* 溢出不换行 */
		-webkit-line-clamp: 2;
		/* 表示显示的行数 */
		-webkit-box-orient: vertical;
		/* 从上到下垂直排列子元素 */
	
	}
	.time {
		height: 33rpx;
		font-size: 24rpx;
		font-family: PingFang SC;
		font-weight: 300;
		line-height: 33rpx;
		color: #666;
		opacity: 1;
		margin-top: 20rpx;
	
	}
</style>
